package day12.properties;

import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Properties;

/**
 * @author Xiao
 * @date 2021/8/3
 */
public class PropertiesDemo04 {
    /**
     * void store(Writer writer, String comments):
     * 	将集合中的键值对数据写出到本地文件中
     */
    public static void main(String[] args) throws IOException {
        Properties p = new Properties();
        p.setProperty("阿良", "善良");
        p.setProperty("左右", "为难");
        p.setProperty("平安", "平安");
        FileWriter fw = new FileWriter(
                "videoPractice\\src\\day12\\properties\\prop2.properties");
        p.store(fw, "comments");
        //第二个参数传入null时表示不写注释信息。
        //p.store(fw, null);
        fw.close();
        System.out.println(p);
    }
}
